package com.itheima.interceptor;

import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
       //注册拦截器对象
        registry.addInterceptor(loginInterceptor)
                //拦截所有的路径
                .addPathPatterns("/**")
                //除了login路径
                .excludePathPatterns("/login");
        /* /**在拦截器中表示拦截所有路径
            /*拦截一级路径

            /*在过滤器中拦截所有路径
         */

    }
}
